﻿@model ArivisTests.Models.TestRun
@using ArivisTests.Views;

@{
    ViewBag.Title = Model.Name;
    string details = Request.QueryString["details"];
}

@section Navigation{
    @Html.ActionLink("Test Runs", "Index") &rsaquo; @Html.DisplayFor(model => model.Name)
}

<fieldset class="with-border">
    <legend>TestRun</legend>
    <div style="margin-top:1em;margin-bottom:0.5em;">
        @Html.TestProgressText(Model.Tests)
    </div>
    <table class="display-table">
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.Name)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.Name)
            </td>

        </tr>
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.Date)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.Date)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.Active)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.Active)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.Progress)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.Progress)
            </td>
        </tr>
        <tr>
            <td class="display-label">
                @Html.DisplayNameFor(model => model.Results)
            </td>
            <td class="display-field">
                @Html.DisplayFor(model => model.Results)
            </td>
        </tr>
    </table>
    <p></p>
</fieldset>
<p></p>
<fieldset class="with-border">
    <legend>
@{
    string view = Request["view"];
    string partialview = "_TestDetails";
    if (view == "tester")
    {
        partialview = "_TestsByUser";
        @Html.ActionLink("Test Details", "Details", new { id = Model.Id, view = "details" })
        <span style="font-weight:normal;">|</span>
        <text>Progress By Tester</text>
        <span style="font-weight:normal;">|</span>
        @Html.ActionLink("Wiki", "Details", new { id = Model.Id, view = "wiki" })
    }
    else if (view == "wiki")
    {
        partialview = "_TestsWiki";
        @Html.ActionLink("Test Details", "Details", new { id = Model.Id, view = "details" })
        <span style="font-weight:normal;">|</span>
        @Html.ActionLink("Progress By Tester", "Details", new { id = Model.Id, view = "tester" })
        <span style="font-weight:normal;">|</span>
        <text>Wiki</text>
    }
    else
    {
        partialview = "_TestDetails";
        <text>Test Details</text>
        <span style="font-weight:normal;">|</span>
        @Html.ActionLink("Progress By Tester", "Details", new { id = Model.Id, view = "tester" })
        <span style="font-weight:normal;">|</span>
        @Html.ActionLink("Wiki", "Details", new { id = Model.Id, view = "wiki" })
    }
}
    </legend>
@{
    @Html.Partial(partialview, Model.Tests);
}
</fieldset>

<p>
    @Html.ActionLink("Edit", "Edit", new { id=Model.Id }) |
    @Html.ActionLink("Delete", "Delete", new { id=Model.Id }) |
    @Html.ActionLink("Assign Tester Manual", "Manual", "AssignTest", new { id = Model.Id }, null) |
    @Html.ActionLink("Assign Tester Automatic", "Automatic", "AssignTest", new { id = Model.Id }, null)
</p>
